package com.hkts.naturalgas.association.service.serviceimpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hkts.naturalgas.association.entity.ProvideDataAddress;
import com.hkts.naturalgas.association.mapper.ProvideDataAddressMapper;
import com.hkts.naturalgas.association.service.IProvideDataAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author yck
 * @since 2021-12-20
 */
@Service
@Transactional
public class ProvideDataAddressServiceImpl extends ServiceImpl<ProvideDataAddressMapper, ProvideDataAddress> implements IProvideDataAddressService {


    @Autowired
    private ProvideDataAddressMapper provideDataAddressMapper;

    @Override
    public IPage<ProvideDataAddress> selectPage(Page<ProvideDataAddress> page, ProvideDataAddress provideDataAddress) {
        QueryWrapper<ProvideDataAddress> query = Wrappers.query();
        QueryWrapper<ProvideDataAddress> entityWrapper = getEntityWrapper(query, provideDataAddress);
        return provideDataAddressMapper.selectPage(page, entityWrapper);
    }


    @Override
    public List<ProvideDataAddress> selectList(ProvideDataAddress provideDataAddress) {
        QueryWrapper<ProvideDataAddress> query = Wrappers.query();
        QueryWrapper<ProvideDataAddress> entityWrapper = getEntityWrapper(query, provideDataAddress);
        return provideDataAddressMapper.selectList(entityWrapper);
    }

    /**
     * 公共查询条件
     *
     * @param entityWrapper
     * @return
     */
    public QueryWrapper<ProvideDataAddress> getEntityWrapper(QueryWrapper<ProvideDataAddress> entityWrapper, ProvideDataAddress provideDataAddress) {
        //条件拼接

        return entityWrapper;
    }
}
